package com.magold.modifier;

import org.andengine.entity.modifier.AlphaModifier;
import org.andengine.entity.modifier.ColorModifier;
import org.andengine.entity.modifier.IEntityModifier;
import org.andengine.entity.modifier.LoopEntityModifier;
import org.andengine.entity.modifier.RotationModifier;
import org.andengine.entity.modifier.ScaleModifier;
import org.andengine.entity.modifier.SequenceEntityModifier;
import org.andengine.util.color.Color;
import org.andengine.util.modifier.ease.EaseLinear;
import org.andengine.util.modifier.ease.IEaseFunction;

public class ModifierFactory {
	
	public static IEntityModifier createPlaybackScaleModifier(float pDurationForEach, float pFromScale, float pToScale) {
		return createPlaybackScaleModifier(pDurationForEach, pFromScale, pToScale, EaseLinear.getInstance(), EaseLinear.getInstance());
	}
	
	public static IEntityModifier createPlaybackScaleModifier(float pDurationForEach, float pFromScale, float pToScale, IEaseFunction pInFunction, IEaseFunction pOutFunction) {
		return new LoopEntityModifier(
				new SequenceEntityModifier(
					new ScaleModifier(pDurationForEach, pFromScale, pToScale, pInFunction),
					new ScaleModifier(pDurationForEach, pToScale, pFromScale, pOutFunction)));
	}
	
	public static IEntityModifier createPlaybackScaleModifier(float pDurationForEach, float pFromScaleX, float pToScaleX, float pFromScaleY, float pToScaleY) {
		return createPlaybackScaleModifier(pDurationForEach, pFromScaleX, pToScaleX, pFromScaleY, pToScaleY, EaseLinear.getInstance(), EaseLinear.getInstance());
	}
	
	public static IEntityModifier createPlaybackScaleModifier(float pDurationForEach, float pFromScaleX, float pToScaleX, float pFromScaleY, float pToScaleY, IEaseFunction pInFunction, IEaseFunction pOutFunction) {
		return new LoopEntityModifier(
				new SequenceEntityModifier(
					new ScaleModifier(pDurationForEach, pFromScaleX, pToScaleX, pFromScaleY, pToScaleY, pInFunction),
					new ScaleModifier(pDurationForEach, pToScaleX, pFromScaleX, pToScaleY, pFromScaleY, pOutFunction)));
	}
	
	public static IEntityModifier createPlaybackRotationModifier(float pDurationForEach, float pFromRotation, float pToRotation) {
		return createPlaybackRotationModifier(pDurationForEach, pFromRotation, pToRotation, EaseLinear.getInstance(), EaseLinear.getInstance());
	}
	
	public static IEntityModifier createPlaybackRotationModifier(float pDurationForEach, float pFromRotation, float pToRotation, IEaseFunction pInFunction, IEaseFunction pOutFunction) {
		return new LoopEntityModifier(
				new SequenceEntityModifier(
					new RotationModifier(pDurationForEach, pFromRotation, pToRotation, pInFunction),
					new RotationModifier(pDurationForEach, pToRotation, pFromRotation, pOutFunction)));
	}
	
	public static IEntityModifier createPlaybackAlphaModifier(float pDurationForEach, float pFromAlpha, float pToAlpha) {
		return createPlaybackAlphaModifier(pDurationForEach, pFromAlpha, pToAlpha, EaseLinear.getInstance(), EaseLinear.getInstance());
	}
	
	public static IEntityModifier createPlaybackAlphaModifier(float pDurationForEach, float pFromAlpha, float pToAlpha, IEaseFunction pInFunction, IEaseFunction pOutFunction) {
		return new LoopEntityModifier(
				new SequenceEntityModifier(
					new AlphaModifier(pDurationForEach, pFromAlpha, pToAlpha, pInFunction),
					new AlphaModifier(pDurationForEach, pToAlpha, pFromAlpha, pOutFunction)));
	}
	
	public static IEntityModifier createPlaybackColorModifier(float pDurationForEach, Color pFromColor, Color pToColor) {
		return createPlaybackColorModifier(pDurationForEach, pFromColor, pToColor, EaseLinear.getInstance(), EaseLinear.getInstance());
	}
	
	public static IEntityModifier createPlaybackColorModifier(float pDurationForEach, Color pFromColor, Color pToColor, IEaseFunction pInFunction, IEaseFunction pOutFunction) {
		return new LoopEntityModifier(
				new SequenceEntityModifier(
					new ColorModifier(pDurationForEach, pFromColor, pToColor, pInFunction),
					new ColorModifier(pDurationForEach, pToColor, pFromColor, pOutFunction)));
	}
	
}
